<?php

class Helper_Request extends YOU{
	public $get = array();
	public $post = array();
	public $cookie = array();
	public $files = array();
	public $server = array();

	public function __construct() {

		//$this->get = $this->clean($_GET);
		//$this->post = $this->clean($_POST);
		$this->cookie = $this->clean($_COOKIE);
		$this->files = $this->clean($_FILES);
		$this->server = $this->clean($_SERVER);

		$this->get    = isset($_GET)    ? (object)$_GET    : "";
		$this->post   = isset($_POST)   ? (object)$_POST   : "";
		$this->cookie = isset($_COOKIE) ? (object)$_COOKIE : "";
		$this->files  = isset($_FILES)  ? (object)$_FILES  : "";
		$this->server = isset($_SERVER) ? (object)$_SERVER : "";
	}

	public function clean(&$data) {
		if (is_array($data)) {
			foreach ($data as $key => $value) {
				$data[$key] = $this->clean($value);
			}
		} else {
			$data = html_entity_decode($data);
			$data = strip_tags($data);
			$data = addslashes(htmlentities($data, ENT_QUOTES, 'UTF-8'));
		}

		return $data;
	}
}